def prompt()
   print">"
end

def gold_room()
   puts "This room is full of gold, How much do you take?"
   
   prompt; next_move = gets.chomp
   if next_move.include?"0" or next_move.include?"1"
      how_much = next_move.to_i()
   else
      dead("Man, learn to rype a number.")
   end
 
   if how_much < 50
      puts "Nice, you're not greedy,you win!"
      Process.exit(0)
   else
      dead("You greedy bastard!")
   end
end


def bear_room()
   puts "There is a bear here."
   puts "The bear has a bunch of honey."
   puts "The fat bear is in front of another door."
   puts "How are you going to move the bear?"
   bear_moved = false
   
   while true
     prompt; next_move = gets.chomp
    
     if next_move == "take honey"
        dead(("The bear looks at you then slaps your face off.")
     elsif next_move == "taunt bear" and not bear_moved
        puts "The bear has moved from the door. You can go through it now."
        bear_moved = true
     elsif next_move == "raunt bear" and bear_moved
        dead("The bear gets pissed off and chews your leg off.")
     elsif next_move == "open door" and bear_moved
        gold_room()
     else
        puts "I got no idea what that means."
     end
    end
end
def cthulu_room()
   puts "Here you see the great evil cthulu."
   puts "He, it, whatever stares at you and you go insane."
   puts "Do you flee for your life or eat your head?"
   
   prompt; next_move = gets.chomp
   
   if next_move.include?"flee"
      start()
   elsif next_move.include?"head"
      dead("Well that was tasty!")
   else
      cthulu_room()
   end
end

def dead(why)
    puts "#{why} Good job!"
    Process.exit(0)
end

def start()
    puts "You are in a dark room."
    puts "There is a door to your right and left."
    puts "which one do you take?"

    prompt; next_move = gets.chomp

    if next_move == "left"
       bear_room()
    elsif next_move == "right"
       cthulu_room()
    else
        dead("You stumble around the room until you starve.")
    end
end

start() 
  #这一节只能说看得懂，里面涉及到那些用法不熟悉，像next_move，dead，next_move.include之类的，前面的时候就上传过，老是连接失败，我现在在想，如果所我自己去编写一个跟这类似小游戏，英文的估计是写不出来到，除非所用有道，那么我应该可以把输出到东西全都写成中文吧，但是方法定义就很麻烦了
